package com.xb.p42_touchevent;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Toast;

import androidx.annotation.Nullable;

public class TestView extends View {

    public TestView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }


    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawColor(Color.BLUE);
    }


    @Override
    public boolean onTouchEvent(MotionEvent event) {
        Toast.makeText(getContext(),"1-onTouchEvent..."+event.getAction(),Toast.LENGTH_SHORT).show();
        return false;
    }
}
